package com.hup.utils.io.batch;

import java.util.ArrayList;

/**
 * @author hugan
 * @date 2020/1/22
 */
public class SimpleBatchResp {

    public boolean success;
    public String errMsg;

    @Override
    public String toString() {
        if (success) {
            return "成功";
        } else {
            return errMsg;
        }
    }

    public static SimpleBatchResp success() {
        SimpleBatchResp res = new SimpleBatchResp();
        res.success = true;
        return res;
    }

    public static SimpleBatchResp fail(BaseBatch baseBatch, String errMsg) {
        SimpleBatchResp res = new SimpleBatchResp();
        res.success = false;
        res.errMsg = baseBatch.getErrMsg(errMsg);
        return res;
    }

    public static SimpleBatchResp fail(BaseBatch baseBatch, ArrayList<String> lstResp) {
        SimpleBatchResp res = new SimpleBatchResp();
        res.success = false;
        res.errMsg = baseBatch.getErrMsg(lstResp);
        return res;
    }
}
